package com.tz.crm.dao.impl;

import com.tz.crm.dao.GlobalConfigDao;
import com.tz.crm.entity.GlobalConfig;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * 使用 @Repository 将 DAO 类声明为 Bean
 */
@Repository
@Transactional
public class GlobalConfigDaoImpl extends BaseDaoImpl<GlobalConfig, String> implements GlobalConfigDao {

    @Override
    public GlobalConfig findByCode(String code) {
        String hql = "from GlobalConfig gc where gc.code = :code";
        return (GlobalConfig) getSession()
                .createQuery(hql)
                .setParameter("code", code)
                .uniqueResult();
    }

}
